home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 16
/
AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso
/
pd
/
anwendungen
/
amicad
/
arexx_english
/
karnaugh.amicad
< prev
next >
Wrap
Text File
|
1998-08-09
|
2KB
|
119 lines
/* Create a table of Karnaugh
Version 1.01e, 9 août 1998, © R.Florac */
options results
signal on error
signal on syntax
'ASK("How many inputs?")'; nbe=result
if nbe="" then exit
do i=1 to nbe
'ASK("Name of input 'i'")'; nomE.i=result
end
'ASK("Output name?")'; nomS=result
'SETSCALE(0,1,1):ROTATE(0,0):SYMMETRY(0,0):DRAWMODE(1)'
nbcases=2**nbe
nblignes=nbe%2
nbcol=nbe-nblignes
c=(nbe-nbcol)*10+20
l0=10+nbcol*15
l1=l0+(2**nblignes)*30
do col=1 to (2**nbcol)+1
select
when col=1 then 'DRAWMODE(2)'
when col=(2**nbcol)+1 then 'DRAWMODE(2)'
otherwise 'DRAWMODE(1)'
end
'MARK(DRAW('c+col*30','l0','c+col*30','l1'))'
col.col=c+col*30
end
c0=(nbe-nbcol)*10+50
c1=c0+((2**nbcol))*30
do i=1 to (2**nblignes)+1
select
when i=1 then 'DRAWMODE(2)'
when i=(2**nblignes)+1 then 'DRAWMODE(2)'
otherwise 'DRAWMODE(1)'
end
'MARK(DRAW('c0','l0','c1','l0'))'
ligne.i=l0
l0=l0+30
end
nbval=(2**nbcol)/2
l0=10+nbcol*15
pas=1
do c=1 to nbcol
if c=nbcol then do
p=nbval+1
d=p+nbval
'MARK(DRAW('col.p','l0-c*10','col.d','l0-c*10'))'
end
else do
p=pas+1
do while p<=nbval*2
r=p+pas*2
'MARK(DRAW('col.p','l0-c*10','col.r','l0-c*10'))'
p=r+pas*2
end
pas=pas*2
end
end
nbval=(2**nblignes)/2
pas=1
do l=1 to nblignes
if l=nblignes then do
p=nbval+1
d=p+nbval
'MARK(DRAW('col.1-10*l','ligne.p','col.1-10*l','ligne.d'))'
end
else do
p=pas+1
do while p<=nbval*2
r=p+pas*2
'MARK(DRAW('col.1-10*l','ligne.p','col.1-10*l','ligne.r'))'
p=r+pas*2
end
pas=pas*2
end
end
'ROTATE(0,3):DRAWMODE(1)'
do i=1 to nblignes
if nomE.i="" then nomE.i='?'
'MARK(WRITE("'nomE.i'",'col.1-10*i+3','ligne.d+10'+TXHEIGHT("'nomE.i'")))'
c=c+15
end
'ROTATE(0,0)'
d=(2**nbcol)+1
do while i<=nbe
if nomE.i="" then nomE.i='?'
'MARK(WRITE("'nomE.i'",'col.d+5','ligne.1+4-10*(i-nblignes)'))'
i=i+1
end
if nomS="" then nomS="?"
d=d%2+1
p=(2**nblignes)+1
'MARK(WRITE("'nomS'",'col.d'-TXWIDTH("'nomS'")/2,'ligne.p+15'))'
exit
syntax:
erreur=RC
'MESSAGE("Script Karnaugh"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
exit
error:
'MESSAGE("Script Karnaugh"+CHR(10)+"Error in line 'SIGL'")'
exit